package concurrent;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.TimeUnit;

@Slf4j
public class SleepDemo {
    public static void main(String[] args) throws InterruptedException {
        Thread t1 = new Thread(() -> {
            System.out.println("t1 starting...");
            try {
                TimeUnit.SECONDS.sleep(2);
                System.out.println("t1 try end...");
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("t1 ending...");
        }, "t1");
        t1.start();
        t1.interrupt();
        log.info("aa");

        System.out.println("main starting...");
        TimeUnit.SECONDS.sleep(1);
        System.out.println("main ending...");
    }
}
